#include "NtService.h"
#include "Service.h"


VOID
ServiceStart(
             __in DWORD argc,
             __in_ecount(argc) WCHAR **argv
             )
             
/*++

    Routine Description:

    This function starts the service.

    Arguments:

        DWORD argc - The argument count.

        LPTSTR *argv - The arguments.

    Return value:

        None.

--*/

{
    UNREFERENCED(argc);
    UNREFERENCED(argv);

    HRESULT Error = S_OK;
    DWORD WinError = ERROR_SUCCESS;

    //
    // Report status that the service in starting to service control manager.
    //
    WinError = UpdateServiceStatus(
        SERVICE_START_PENDING,
        NO_ERROR,
        DEFAULT_WAIT_HINT
        );

    if (WinError != ERROR_SUCCESS)
    {
        ERROR_EXIT(WinError);
    }

    //
    // Report status that the service in running to service control manager.
    //
    WinError = UpdateServiceStatus(
        SERVICE_RUNNING,
        NO_ERROR,
        DEFAULT_WAIT_HINT
        );

    return;

exit:
    UNREFERENCED(Error);
    
    // Stop the service.
    ServiceStop();
}

VOID
ServiceStop(
            )

/*++

    Routine Description:

    This function stops the service.

    Arguments:

        None.

    Return value:

        None.

--*/

{
    DWORD WinError = ERROR_SUCCESS;
    
    //
    // Report status that the service in running to service control manager.
    //
    WinError = UpdateServiceStatus(
        SERVICE_STOPPED,
        NO_ERROR,
        0
        );
}